home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 60754 / 60754.xpi / chrome / content / data.js next >
Text File  |  2010-02-05  |  1KB  |  28 lines

  1. function getData() {
  2.  
  3.     function giveData() {
  4.         var output1 = httpRequest1.responseText.split("\n");
  5.         var output2 = httpRequest2.responseText.split("\n");
  6.         if (output1[0] == 1) postMessage(output1[1] + "\n" + output1[2] + "\n" + output1[3] + "\n" + output1[4] + "\n" + output1[5] + "\n" + output1[6] + "\n" + output1[7] + "\n" + output1[8] + "\n" + output1[9] + "\n" + output1[10] + "\n" + output1[11]);
  7.         else postMessage(output1[1] + "\n" + output1[2] + "\n" + output1[3] + "\n" + output2[1] + "\n" + output2[2] + "\n" + output2[3] + "\n" + output2[4] + "\n" + output1[8] + "\n" + output1[9] + "\n" + output1[10] + "\n" + output1[11]);
  8.         httpRequest1 = null;
  9.         httpRequest2 = null;
  10.     }
  11.  
  12.     var httpRequest1 = new XMLHttpRequest();
  13.     httpRequest1.open("GET", "http://max91ao.altervista.org/ststimer/mission/missionsData.txt", false);
  14.     httpRequest1.onload = giveData;
  15.     httpRequest1.send(null);
  16.  
  17.     var httpRequest2 = new XMLHttpRequest();
  18.     httpRequest2.open("GET", "http://www.forumastronautico.it/countdown/ststimer.php", false);
  19.     httpRequest2.onload = giveData;
  20.     httpRequest2.send(null);
  21.  
  22. }
  23.  
  24. setInterval(getData, 5*60*1000);
  25.  
  26. onmessage = function(event) {
  27.     getData();
  28. }